<template>
	<view>
		<form @submit="formSubmit" class="register">
			<!-- <view class="img" style="display: flex;justify-content: center;">
				<image src="../../static/images/111.png" style="border-radius: 13px;width: 266px;height: 120px;"></image>
			</view> -->
			<view class="userName">
				<input type="text" name="userName" v-model="userName" placeholder="请填写账号"/>
			</view>
			<view class="userPwd">
				<input type="password" name="userPwd" v-model="userPwd" placeholder="请填写密码"/>
			</view>
			<view class="userName">
				<input type="text" name="userReal" v-model="userReal" placeholder="真实姓名"/>
			</view>
			<view class="userName">
				<input type="text" name="userPhone" v-model="userPhone" placeholder="请填写手机号"/>
			</view>
			<view class="userName">
				<input type="text" name="userEmail" v-model="userEmail" placeholder="请填写邮箱"/>
			</view>
			<view class="userName">
				<input type="text" name="userClass" v-model="userClass" placeholder="请填写班级"/>
			</view>
			<view class="userName">
				<input type="text" name="userCourse" v-model="userCourse" placeholder="请填写专业"/>
			</view>
			<view class="btn">
				<button form-type="submit" type="default">提交</button>
				<button form-type="reset" type="default">重置</button>
			</view>
		</form>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				userName:'',
				userPwd:'',
				userReal:'',
				userPhone:'',
				userEmail:'',
				userClass:'',
				userCourse:''
				
			}
		},
		methods:{
			formSubmit(){
				uni.request({
					url:this.serverUrl+"renren/usertable/save",
					method:'POST',
					data:{
						userName:this.userName,
						userPwd:this.userPwd,
						userReal:this.userReal,
						userPhone:this.userPhone,
						userEmail:this.userEmail,
						userClass:this.userClass,
						userCourse:this.userCourse
					},
					success(res) {
						debugger
						console.log(res.data)
					    if(res.data.code===0){
							uni.showToast({
								title:"注册成功",
								duration:2000
							})
						}else{
							uni.showToast({
								title:"注册失败",
								duration:2000
							})
						}	
					}
				})
			}
		}
	}
</script>

<style>
	.register{
		margin-top: 50upx;
		display: flex;
		flex-direction: column;
		align-items: center;
		padding: 10upx;
	}
	.userName,.userPwd,.userPhone{
		margin-top: 20upx;
		margin-bottom: 20upx;
		
	}
	input{
		border: 1px solid #CCCCCC;
		padding: 20upx;
		border-radius: 16upx;
	}
	.btn{
		margin-top: 60upx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
	}
	button{
		margin-right: 60upx;
	}
</style>
